<?php 
require_once 'include/prepend.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<body>
<h1><img src="images/gestion_ville.png" align="absmiddle" />Gestion des villes</h1>
<pre>
<font color="#112233">
<?php
  ob_start();
##  *** put a primary key on the first place 
  $sql=" SELECT "  
 	   ."id_ville, "
   	   ."nom_ville "
	   ."FROM ville ";
   
##  *** set needed options
  $debug_mode 		= false;
  $messaging 		= true;
  $unique_prefix 	= "f_";  
  $dgrid 			= new DataGrid($debug_mode, $messaging, $unique_prefix, DATAGRID_DIR);
  $dg_encoding 		= "utf-8";
  $dg_collation 	= "utf8_unicode_ci";
  $dgrid->SetEncoding($dg_encoding, $dg_collation);
  $dgrid->SetInterfaceLang("fr");
##  *** set paging settings
 $bottom_paging 	= array("results"=>true, "results_align"=>"left", "pages"=>true, "pages_align"=>"center", "page_size"=>true, "page_size_align"=>"right");
 $top_paging 		= array("results"=>true, "results_align"=>"left", "pages"=>true, "pages_align"=>"center", "page_size"=>true, "page_size_align"=>"right");
 $pages_array 		= array("10"=>"10", "25"=>"25", "50"=>"50", "100"=>"100", "250"=>"250", "500"=>"500", "1000"=>"1000");
 $default_page_size = 10;
 $paging_arrows 	= array("first"=>"|&lt;&lt;", "previous"=>"&lt;&lt;", "next"=>"&gt;&gt;", "last"=>"&gt;&gt;|");
 $dgrid->SetPagingSettings($bottom_paging, $top_paging, $pages_array, $default_page_size, $paging_arrows);
## *** recherche
 $filtering_option 	= false;
$show_search_type	= false;
$dgrid->AllowFiltering($filtering_option, $show_search_type);


##  *** set data source with needed options
  $default_order_field = "nom_ville";
  $default_order_type  = "ASC";
  $dgrid->dataSource($db_conn, $sql, $default_order_field, $default_order_type);	    

## +---------------------------------------------------------------------------+
## | 6. View Mode Settings:                                                    | 
## +---------------------------------------------------------------------------+
##  *** set columns in view mode
   $dgrid->setAutoColumnsInViewMode(true);  

## +---------------------------------------------------------------------------+
## | 7. Add/Edit/Details Mode settings:                                        | 
## +---------------------------------------------------------------------------+
##  ***  set settings for edit/details mode
  $table_name = "ville";
  $primary_key = "id_ville";
  $condition = "";
  $dgrid->setTableEdit($table_name, $primary_key, $condition);
  $dgrid->setAutoColumnsInEditMode(true);
  
## +---------------------------------------------------------------------------+
## | 8. Bind the DataGrid:                                                     | 
## +---------------------------------------------------------------------------+
##  *** set debug mode & messaging options
    $dgrid->bind();        
    ob_end_flush();
################################################################################   
?>
</font>
</pre>
</body>
</html>